﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data; 

namespace xml_to_db
{
    public abstract class Client
    {
        protected abstract ISchemaAdapter Adapter{get; set;}
        public abstract void Create(DataSet schema);        
    }
    
    public class SQLClientAdapter : Client
    {
        public readonly string Host;
        
        public SQLClientAdapter(string host)
        {
            if (host == null)
                throw new ApplicationException("Host is not identified.");

            this.Host = host;
            if (this.Adapter == null)
                this.Adapter = new SQL80SchemaAdapter(this.Host);
        }

        protected override ISchemaAdapter Adapter { get; set; }       
        
        public override void Create(DataSet schema)
        {            
            this.Adapter.Create(schema, true);            
        }
    }


    public class TextClientAdapter : Client
    {


        protected override ISchemaAdapter Adapter
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public override void Create(DataSet schema)
        {
            //throw new NotImplementedException();
        }
    }

    public class CSVClientAdapter : Client
    {

        protected override ISchemaAdapter Adapter
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public override void Create(DataSet schema)
        {
            throw new NotImplementedException();
        }
    }

}
